<template>
	<view class="content">
		<!-- 顶部装饰云朵 -->
		<view class="clouds">
			<image src="@/static/word/cloud1.png" class="cloud cloud-1"></image>
			<image src="@/static/word/cloud2.png" class="cloud cloud-2"></image>
		</view>

		<!-- Logo 和标题区域 -->
		<view class="header">
			<image class="logo" src="@/static/logo/logo.png" mode="aspectFit"></image>
			<text class="title">向日葵英语</text>
		</view>

		<!-- 功能区域 -->
		<view class="features">
			<!-- 拍照翻译 -->
			<view class="feature-item" @click="onPhotoTranslate">
				<view class="feature-card">
					<image class="icon" src="@/static/photo.png" mode="aspectFit"></image>
					<text class="feature-text">Photo Magic</text>
					<text class="feature-desc">Take a photo to translate!</text>
				</view>
			</view>

			<!-- 文本翻译 -->
			<view class="feature-item" @click="onTextTranslate">
				<view class="feature-card">
					<image class="icon" src="@/static/text.png" mode="aspectFit"></image>
					<text class="feature-text">Text Fun</text>
					<text class="feature-desc">Type and learn!</text>
				</view>
			</view>

			<!-- 语音翻译 -->
			<view class="feature-item" @click="onVoiceTranslate">
				<view class="feature-card">
					<image class="icon" src="@/static/voice.png" mode="aspectFit"></image>
					<text class="feature-text">Voice Play</text>
					<text class="feature-desc">Speak and discover!</text>
				</view>
			</view>
		</view>

		<!-- 底部装饰 -->
		<view class="bottom-decoration">
			<image src="@/static/word/grass.webp" class="grass" mode="scaleToFill"></image>
		</view>
	</view>
</template>

<script>
export default {
	onLoad: function () {},
	methods: {
		onPhotoTranslate() {
			console.log('拍照翻译');
			this.$router.push('/pages/photoToTranslate/photoToTranslate');
		},
		onTextTranslate() {
			console.log('文本翻译');
			this.$router.push('/pages/textToTranslate/textToTranslate');
		},
		onVoiceTranslate() {
			console.log('语音翻译');
			this.$router.push('/pages/voiceToTranslate/voiceToTranslate');
		}
	}
};
</script>

<style>
.content {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 100vh;
	background: linear-gradient(180deg, #B2EBF2 0%, #E0F7FA 100%);
	position: relative;
	overflow: hidden;
}

/* 云朵动画 */
.clouds {
	position: absolute;
	top: 0;
	width: 100%;
	height: 200rpx;
}

.cloud {
	position: absolute;
	width: 150rpx;
	height: 80rpx;
}

.cloud-1 {
	left: 10%;
	animation: floatCloud 15s infinite linear;
}

.cloud-2 {
	right: 15%;
	animation: floatCloud 20s infinite linear reverse;
}

@keyframes floatCloud {
	0% { transform: translateX(0); }
	50% { transform: translateX(50rpx); }
	100% { transform: translateX(0); }
}

/* 头部样式 */
.header {
	margin-top: 160rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
	z-index: 1;
}

.logo {
	width: 200rpx;
	height: 200rpx;
	border-radius: 50%;
	box-shadow: 0 8rpx 16rpx rgba(0, 0, 0, 0.1);
	background: white;
	padding: 20rpx;
}

.title {
	margin-top: 30rpx;
	font-size: 48rpx;
	color: #2196F3;
	font-family: 'Comic Sans MS', sans-serif;
	font-weight: bold;
	text-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.1);
}

/* 功能区域 */
.features {
	display: flex;
	flex-direction: column;
	gap: 30rpx;
	width: 90%;
	margin-top: 60rpx;
	z-index: 1;
}

.feature-item {
	width: 100%;
}

.feature-card {
	background: rgba(255, 255, 255, 0.9);
	border-radius: 30rpx;
	padding: 40rpx;
	display: flex;
	align-items: center;
	box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.1);
	transition: transform 0.3s ease;
}

.feature-card:active {
	transform: scale(0.98);
}

.icon {
	width: 100rpx;
	height: 100rpx;
	margin-right: 40rpx;
}

.feature-text {
	font-size: 36rpx;
	color: #333;
	font-weight: bold;
	font-family: 'Comic Sans MS', sans-serif;
	margin-bottom: 10rpx;
}

.feature-desc {
	font-size: 24rpx;
	color: #666;
	font-family: 'Comic Sans MS', sans-serif;
}

/* 底部装饰 */
.bottom-decoration {
	position: absolute;
	bottom: 0;
	width: 100%;
	z-index: 0;
}

.grass {
	width: 100%;
	height: 120rpx;
}

/* 为每个功能卡片设置不同的强调色 */
.feature-item:nth-child(1) .feature-card {
	border-left: 10rpx solid #FF9800;
}

.feature-item:nth-child(2) .feature-card {
	border-left: 10rpx solid #4CAF50;
}

.feature-item:nth-child(3) .feature-card {
	border-left: 10rpx solid #2196F3;
}
</style>
